Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Yannick Smits 321 posts 718 karma points
    Mar 24, 2011 @ 11:14
    Yannick Smits
    0

    Select a node in "up-down" style

    I want to select the ID of the first child of the first child of the root node but can't seem to find how. This is what I have in the select:

    $currentPage/ancestor-or-self::*[1]/child::*[1]/child::*[1]/@id
  • Daniel Bardi 927 posts 2562 karma points
    Mar 24, 2011 @ 11:50
    Daniel Bardi
    0

    Try this:

    $currentPage/ancestor-or-self[level='1'][1]/*[1]/*[1]/@id
  • Yannick Smits 321 posts 718 karma points
    Mar 24, 2011 @ 12:10
    Yannick Smits
    0

    nope doesn't work either. 

  • Pasang Tamang 258 posts 458 karma points
    Mar 24, 2011 @ 12:53
    Pasang Tamang
    0

    This works perfectly for me

    <xsl:value-of select="$currentPage/ancestor-or-self :: *[@isDoc] [@level=1]/*[@isDoc]/*[@isDoc]/@id"/>
  • Yannick Smits 321 posts 718 karma points
    Mar 24, 2011 @ 13:07
    Yannick Smits
    0

    thanks that works! any comments on why my snippet didn't work?

  • Daniel Bardi 927 posts 2562 karma points
    Mar 24, 2011 @ 17:33
    Daniel Bardi
    0

    oops.. forgot the @level instead of just level.. my bad.

    you don't need child::*

Please Sign in or register to post replies

Write your reply to:

Draft